//
//  PCDApiScanCode.m
//  PCDBankSix
//
//  Created by DK on 2022/3/9.
//

#import "PCDApiScanCode.h"
#import "PCScanViewController.h"

@interface PCDApiScanCode()<PCScanViewControllerDelegate>
@property(nonatomic,copy) NSString *strCallBack;
@end

@implementation PCDApiScanCode

- (void)handler:(id)data andContext:(PCDContext *)context ResponseCallback:(WVJBResponseCallback )responseCallback
{
    //
    NSDictionary *parameters = (NSDictionary *)data;
    self.strCallBack= [parameters objectForKey:@"success"];
    
    UIViewController *viewContrl = context.viewController;

    PCScanViewController *scanView = [[PCScanViewController alloc] initWithNibName:@"PCScanViewController" bundle:nil];
    
    scanView.delegate = self;
    
    [viewContrl.navigationController pushViewController:scanView animated:YES];
}

-(void)scanVC:(PCScanViewController *)vc result:(NSString *)stringValue
{
    
    [vc.navigationController popViewControllerAnimated:YES];
    
    evaluateJavaScriptOnMainThread_quotes(self, self.strCallBack, stringValue);
}

@end
